import { Component } from 'react';

class zidingyi extends Component {
  constructor() {
    super();
    this.state = {
      count:10,
      data:{
        id:1,
        name:2
      }
    }
  }

  // 点击加一
  jia = ()=>{
    this.setState({
      count:this.state.count + 1
    })
  }

  render() { 
    return ( 
      <>
        <div className='zidingyi'>
          count:{this.state.count}
        </div>
        <button onClick={this.jia}>count++</button>
      </>
     );
  }
}
 
export default zidingyi;